package planit.view;

import java.awt.Color;
import java.awt.Graphics;
import java.util.Calendar;

import planit.model.Event;
import planit.model.Model;
import planit.util.ExtendedDate;


@SuppressWarnings("serial")
public class SchedulePaneDay extends SchedulePane {
	
	public SchedulePaneDay(Model model) {
		super(ExtendedDate.createDate(), 1, model);
	}
	
    protected void paintComponent(Graphics g) {
    	super.paintComponent(g);
        int col = 0;
        int pos = 0;
		for (Event e : events) {
			cal.setTime(e.getStartTime());
			pos = minutesToHeight(cal.get(Calendar.MINUTE) + cal.get(Calendar.HOUR_OF_DAY)*60);
			//if (ExtendedDate.isSameDay(e.getStartTime(), startDate)) {
				if (collisions.get(e).size() > 0) {
					drawEvent(g, e, col*(this.getWidth()/columnsPerDay), pos, minutesToHeight(e.getDuration()), this.getWidth()/columnsPerDay);
					col++;
				} else {
					drawEvent(g, e, 0, pos, minutesToHeight(e.getDuration()), this.getWidth());
				}
			//}
		}
    }
}
